package com.cuixk.microservice.consul.controller;

import com.cuixk.microservice.consul.entity.User;
import com.cuixk.microservice.consul.feign.UserFeign;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/get")
public class OrderController {

    @Resource
    private LoadBalancerClient loadBalancerClient;

    @Resource
    private UserFeign userFeign;

    @GetMapping("/{id}")
    public String getUserInfo(@PathVariable Integer id) {
        User userInfo = userFeign.getUserInfo(id);
        return userInfo.toString();
    }


}
